CC=gcc
CFLAGS=-c
FASM=fasm
OBJ=main.o esest.o puertos.o kernelib.o
CP=cp

all: msg kernel.bin

kernel.bin: kernel.o
	objcopy -R .note -R .comment -S -O binary kernel.o kernel.bin
	$(CP) kernel.bin b:

kernel.o: $(OBJ)
	$(LD) -e __main -Ttext 0x1000 -Map kernel.txt -o kernel.o $(OBJ)

main.o:
	$(CC) $(CFLAGS) -ffreestanding -o main.o main.c

esest.o:
puertos.o:
kernelib.o:
	$(FASM) kernelib.asm kernelib.o

.PHONY: clean msg
clean:
	-$(RM) $(OBJ)
	-$(RM) kernel.o kernel.bin kernel.txt
msg:
	@echo "----------========== KERNEL ==========----------"
